﻿Public Class ViewerForm

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If OpenFileDialog1.ShowDialog = DialogResult.OK Then
            PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
            Me.Text = "Picture Viewer (" & OpenFileDialog1.FileName & ")"
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.Height -= 20
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Me.Height += 20
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim g As Graphics
        'g = Me.CreateGraphics
        'g.Clear(SystemColors.Control)
        'g.DrawRectangle(Pens.Blue, PictureBox1.Left - 1, PictureBox1.Top - 1, PictureBox1.Width + 1, PictureBox1.Height + 1)
        'g.Dispose()

        g = PictureBox1.CreateGraphics
        g.Clear(SystemColors.Control)
        g.DrawRectangle(Pens.Blue, 10, 10, 50, 50)

        g.Dispose()
    End Sub

    Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
        Label1.Text = "X: " & e.X
        Label2.Text = "Y: " & e.Y
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Label1.Text = ""
        Label2.Text = ""
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        'OptionsForm.Show()
        OptionsForm.ShowDialog()
    End Sub

    Private Sub PictureBox1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
        Dim g As Graphics

        g = PictureBox1.CreateGraphics
        g.Clear(SystemColors.Control)
        g.DrawRectangle(Pens.Blue, 10, 10, 50, 50)

        g.Dispose()
    End Sub
End Class
